#import "AddressAnnotationCollection.h"

// Shared instance of PointOfInterestCollection
static AddressAnnotationCollection* sharedAddressAnnotationCollection = nil;

/**
 * A shared persistent collection of the user-defined annotations.
 *
 * @author      Justin Hollander
 * @version     1.4.2
 * @since       1.4.2
 * @see         PersistentDataCollection
 */
@implementation AddressAnnotationCollection

/**
 * Returns the shared annotation collection. 
 *
 * @return  the shared annotation collection
 */
+ (AddressAnnotationCollection*)sharedAddressAnnotationCollection {
	@synchronized(self) {
		if (sharedAddressAnnotationCollection == nil) {
			sharedAddressAnnotationCollection = [AddressAnnotationCollection alloc];
			[sharedAddressAnnotationCollection initWithFile:ANNOTATION_FILENAME 
										  usingSubdirectory:ANNOTATION_SUBDIRECTORY];
		}
	}
	
	return sharedAddressAnnotationCollection;
}

/**
 * Deallocate the annotation collection.
 */
- (void)dealloc {
	[sharedAddressAnnotationCollection release], sharedAddressAnnotationCollection = nil;
	[super dealloc];
}

@end
